package com.piesat.quake.business.device.model;

import com.piesat.quake.business.device.mqtt.anno.ConvertField;
import com.piesat.quake.business.device.mqtt.anno.PipelineNode;
import com.piesat.quake.business.device.mqtt.convert.TimestampConvert;

/**
 * 配置请求报文
 * 设备下行 QoS1
 *
 * @author Gersy
 * @date 2023/2/14
 * @since 1.0
 */
@PipelineNode(preNodes = {BaseModel.class})
public class FeatureRequest extends BaseModel {
    //    请求特征值下载开始时间戳	Double	8B	格林威治时间1970年01月01日00时00分00秒（北京时间1970年01月01日08时00分00秒）起至现在的总秒数
    @ConvertField(length = 8, convert = TimestampConvert.class)
    private long dataTimeStamp;

    public FeatureRequest() {
        super("fc");
    }

    public static FeatureRequest create(String id, long dataTimeStamp) {
        FeatureRequest featureRequest = new FeatureRequest();
        featureRequest.setId(id);
        featureRequest.dataTimeStamp = dataTimeStamp;
        featureRequest.createTimestamp();
        return featureRequest;
    }

    public long getDataTimeStamp() {
        return dataTimeStamp;
    }

    public void setDataTimeStamp(long dataTimeStamp) {
        this.dataTimeStamp = dataTimeStamp;
    }

    @Override
    public String toString() {
        return "FeatureRequest{" +
                "dataTimeStamp=" + dataTimeStamp +
                ", type='" + type + '\'' +
                ", length=" + length +
                ", id='" + id + '\'' +
                ", endian=" + endian +
                ", timestamp=" + timestamp +
                '}';
    }
}
